parameters:
  alwaysRun: false
  isExtraPlatformsBuild: false
  isWasmOnlyBuild: false
  platforms: []
  extraBuildArgs: ''

jobs:

#
# Build the whole product using Mono and run runtime tests
#
- template: /eng/pipelines/common/platform-matrix.yml
  parameters:
    jobTemplate: /eng/pipelines/common/global-build-job.yml
    helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
    buildConfig: Release
    runtimeFlavor: mono
    platforms: ${{ parameters.platforms }}
    variables:
      - name: alwaysRunVar
        value: ${{ parameters.alwaysRun }}
      - name: timeoutPerTestInMinutes
        value: 10
      - name: timeoutPerTestCollectionInMinutes
        value: 200
      - name: shouldRunOnDefaultPipelines
        value: $[
          or(
            eq(variables['wasmDarcDependenciesChanged'], true),
            eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_tools_illink.containsChange'], true),
            eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_wasm_runtimetests.containsChange'], true))
          ]
    jobParameters:
      testGroup: innerloop
      isExtraPlatforms: ${{ parameters.isExtraPlatformsBuild }}
      nameSuffix: AllSubsets_Mono_RuntimeTests
      runtimeVariant: monointerpreter
      buildArgs: -s mono+libs -c $(_BuildConfig) /p:InstallV8ForTests=false ${{ parameters.extraBuildArgs }}
      timeoutInMinutes: 180
      condition: >-
        or(
          eq(variables['alwaysRunVar'], true),
          eq(variables['isDefaultPipeline'], variables['shouldRunOnDefaultPipelines']))
      postBuildSteps:
        - template: /eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml
          parameters:
            creator: dotnet-bot
            testRunNamePrefixSuffix: Mono_$(_BuildConfig)
            testBuildArgs: /p:InstallV8ForTests=false
      extraVariablesTemplates:
        - template: /eng/pipelines/common/templates/runtimes/test-variables.yml
